home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / oath.lha / oath / test / dll2b.cc < prev    next >
C/C++ Source or Header  |  1991-08-29  |  2KB  |  77 lines

  1. #include "oath/dlList.h"
  2.  
  3. #include "oath/character.h"
  4.  
  5. #include <fstream.h>
  6.  
  7. /////////////////////////////////////////////////////////////////////////////
  8. // Test of dlLists
  9.  
  10. main ()
  11.    {// Predefine Four Characters //////////
  12.     characterA A = characterA::make('A');
  13.     characterA B = characterA::make('B');
  14.     characterA C = characterA::make('C');
  15.     characterA D = characterA::make('D');
  16.  
  17.     cout << A << B << C << D << endl;
  18.  
  19.     // Retrieve the Three Lists //////////
  20.     ifstream File ("dll2.obj");
  21.  
  22.     listA LN = listA::isa(objA::import(File));
  23.  
  24.     dlListA L1 = dlListA::isa(LN[0]);
  25.     dlListA L2 = dlListA::isa(LN[1]);
  26.     dlListA L3 = dlListA::isa(LN[2]);
  27.  
  28.     // Test Code //////////
  29.  
  30.     if(L1.is(L2) || L1.is(L3))
  31.         cout << "is() failed!" << endl;
  32.     else
  33.         cout << "is() succeeded!" << endl;
  34.  
  35.     if(L1 == L2 && L1 == L3)
  36.         cout << "== succeeded!" << endl;
  37.     else
  38.         cout << "== failed!" << endl;
  39.  
  40.     if(L1.isEmpty() || L2.isEmpty() || L3.isEmpty())
  41.         cout << "isEmpty() failed!" << endl;
  42.     else
  43.         cout << "isEmpty() succeeded!" << endl;
  44.  
  45.     if(L1.contains(A) && L1.contains(B) && !L1.contains(D))
  46.         cout << "contains() succeeded!" << endl;
  47.     else
  48.         cout << "contains() failed!" << endl;
  49.  
  50.     cout << "There are " << L1.count() << " characters in L1: ";
  51.     posA P1 = L1.makePos();
  52.     while(P1())
  53.        {cout << characterA::isa(*P1);
  54.         ++P1;
  55.        }
  56.     cout << endl;
  57.  
  58.     cout << "The second character is "
  59.          << characterA::isa(L1[1]) << endl;
  60.  
  61.     objA O;
  62.     L2 >> O;
  63.     cout << "The first character removed is " 
  64.          << characterA::isa(O) << endl;
  65.  
  66.     cout << "There are " << L2.count() << " characters in L2: ";
  67.     posA P2 = L2.makePos();
  68.     while(P2())
  69.        {cout << characterA::isa(*P2);
  70.         ++P2;
  71.        }
  72.     cout << endl;
  73.  
  74.    }
  75.  
  76.  
  77.